package com.mdhw.system.dao;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.mdhw.system.entity.SysUser;
import com.mdhw.system.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface SysUserDao extends BaseMapper<SysUser> {
    int deleteByPrimaryKey(Long id);

    int insert(SysUser record);

    int insertSelective(SysUser record);

    SysUser selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(SysUser record);

    int updateByPrimaryKey(SysUser record);

    IPage<SysUserVo> selectUserDetailPage(IPage<SysUser> page, @Param(Constants.WRAPPER) QueryWrapper<SysUser> queryWrapper);
    IPage<SysUserVo> selectUserDetailPage2(IPage<SysUser> page, @Param(Constants.WRAPPER) QueryWrapper<SysUser> queryWrapper);

    /**
     * 通过 userId 查询拥有角色
     * @param userId
     * @return
     */
    List<SysRoleVo> selectRoleListByUser(@Param("userId") Long userId);

    /**
     * 通过 userId 查询拥有菜单
     * @param userId
     * @return
     */
    List<SysMenuVo> selectMenuListByUser(@Param("userId") Long userId);


    /**
     * 通过 role Code 查询 用户列表
     * @param roleCode
     * @return
     */
    List<SysUserVo> selectUserListByRole(@Param("roleCode")String roleCode,@Param("keyWords")String keyWords);
    List<SysUserTree> selectSysUserTree(@Param(Constants.WRAPPER) QueryWrapper<SysUserTree> queryWrapper);

    IPage<SysUserVo> selectDarenListpage(IPage<SysUserVo> page, @Param(Constants.WRAPPER) QueryWrapper<SysUserVo> queryWrapper);
    List<TuanduiInfoVo> selectTuanduiUserInfo( @Param(Constants.WRAPPER) QueryWrapper<SysUser> queryWrapper);
    IPage<SysUserExchangeJifenLogVo> selectExchangeJiFenPage(IPage<SysUserExchangeJifenLogVo> page, @Param(Constants.WRAPPER) Wrapper<SysUserExchangeJifenLogVo> queryWrapper);


}